package m3d29;

public class kRunnable implements Runnable{
    private int ticket = 100;

    @Override
    public void run() {
        while(true) {
            //提高安全问题概率
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if (ticket > 0) {
                System.out.println("票数为" + ticket--);
            }
        }
    }

    public int getTicket() {
        return ticket;
    }

    public void setTicket(int ticket) {
        this.ticket = ticket;
    }
}
